package org.tio.sitexxx.web.server.controller.minip;

import org.tio.http.server.annotation.RequestPath;
import org.tio.sitexxx.service.service.qj.SkipService;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RequestPath(value = "/chat")
public class chat_record {
    /**
     * 返回chat_record_p2p表中的聊天记录，像t-io的数据库表人家数据库字段都有注释，规范问题，必须从源头上解决
     * @param uid  消息发送者
     * @param touid  消息接受者
     * @param pageNum
     * @return
     */
    @RequestPath(value = "/record")
    public List<Map<String,Object>> record_history(Integer uid, Integer touid, Integer pageNum){
        List<Map<String,Object>> resultlist=SkipService.me.chat_record(uid,touid,pageNum);
        if(!resultlist.isEmpty()){
            return resultlist;
        }else{
            resultlist=new ArrayList<>(3);
            Map<String,Object>temp=new HashMap<>(2);
            temp.put("ok",1);
            resultlist.add(temp);
            return resultlist;
        }

    }
}
